package com.poi.demopoi.controller;

import com.poi.demopoi.domain.EmployeeDto;
import com.poi.demopoi.domain.EmployeeVO;
import com.poi.demopoi.service.IEmployeeService;

import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;

public class StatisticsTask implements Callable<List<EmployeeVO>> {

    private IEmployeeService orderQueryService;
    private Integer page;
    private Date startDate;
    private Date endDate;
    private EmployeeDto dto;

    /**
     * 初始化任务类
     *
     * @param orderQueryService
     * @param page
     */
    public StatisticsTask(IEmployeeService orderQueryService, Integer page, EmployeeDto dto) {
        //对数据进行分页查询
        this.orderQueryService = orderQueryService;
        this.page = (page - 1) * EmployeeController.BATCH_AMOUNT;
//        this.startDate = startDate;
//        this.endDate = endDate;
        this.dto = dto;
    }

    @Override
    public List<EmployeeVO> call() throws Exception {

        return orderQueryService.findPagesLogical(dto, page, EmployeeController.BATCH_AMOUNT);
    }
}
